<?
if($_POST[action]=="rec_doinsert"||$_POST[action]=="rec_update"){
	//print_r($_POST);
	  $err = '';
      if($_POST['user_name']==''){
	      $err .= "Username is required<br />";
	  }elseif((strlen($_POST['user_name'])<6||strlen($_POST['user_name'])>12)&&$_POST[action]=="rec_doinsert"){
		$err .= "Username length minimum: 6 , maximum: 12<br />";
	  }
	  if($_POST[password]==''&&$_POST[action]=='rec_doinsert'){
	     $err .= "Password is required<br />";
	  }
	  if($_POST[password]!=''&&strlen($_POST[password])< 6){
	      $err .= "Password length minimum: 6<br />";
	  }
      if($_POST[password2]==''&&$_POST[action]=='rec_doinsert'){
	      $err .= "Confirm password is required<br />";
	  }
	  if($_POST[password2]!=''&&$_POST[password2]!=$_POST[password]){
	      if($_POST[action]=='rec_doinsert'){
		   $err .= "Your password entries did not match!<br />";
		  }
	  }
	  if($_POST[firstname]==''){
	      $err .= "First name is required<br />";
	  }
	  if($_POST[lastname]==''){
	      $err .= "Last Name is required<br />";
	  }
	  if($_POST[email]==''){
	      $err .= "Email address is required<br />";
	  }elseif(!ereg("^[a-zA-Z0-9][a-zA-Z0-9_\.]+[a-zA-Z0-9]@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$", $_POST[email])){
	      $err .= "Invalid Email address<br />";
	  }
	  if($_POST[phone]==''){
	      //$err .= "Phone is required<br />";
	  }
	  if($_POST[jobtitle]==''){
	      $err .= "Job title is required<br />";
	  }
	  if($_POST[spokenlanguage]==''){
	      //$err .= "Spoken languages is required<br />";
	  }
      if($_POST[recruitex]==''){
	      $err .= "Year of experience is required<br />";
	  }
	  if($_POST[howus]=='' && $_POST[action]=="rec_doinsert"){
	     // $err .= "How did you hear about us is required<br />";
	  }
	  if($_POST[companyname]==''){
	      $err .= "Company name is required<br />";
	  }
	  if($_POST[industry]=='0'){
	      $err .= "Industry Category must select one from the list<br />";
	  }
      if($_POST[companysize]==''){
	     // $err .= "Company size is required<br />";
	  }

	  if($_POST[address]==''){
	      $err .= "Address is required<br />";
	  }
	  if($_POST[locity]==''){
	      $err .= "City is required<br />";
	  }
	  if($_POST[lostate]=='0'){
	      $err .= "State must select one from the list<br />";
	  }
	  if($_POST[zip]==''){
	      $err .= "Zip code is required<br />";
	  }
	  if($_POST[locountry]=='0'){
	      $err .= "Country must select one from the list<br />";
	  }
	  if($_POST[generalarea]=='0'){
	      $err .= "Your general service area must select one from the list<br />";
	  }
      if($_POST[pristate]=='0'){
	      $err .= "Primary service area state must select one from the list<br />";
	  }
	  if($_POST[pricountry]=='0'){
	      $err .= "Your Primary Country must select one from the list<br />";
	  }
	  if($_POST[pricountry]!='211'&&$_POST[indicate]==''){
	      $err .= "If service area is outside of the U.S., please indicate location";
		  $err_indicate = 1;
	  }
	  if($_POST[agree1]!='1'&&$_POST[action]=="rec_doinsert"){
	      $err .= "You must agree to and accept enetRecruiter's Terms of Use agreement<br />";
	  }
	  if(!PhpCaptcha::Validate($_POST['imagecode'])&&$_POST[action]=="rec_doinsert"){
		  $err .= "Invalid Safe Code.  Please try again.<br>";
	  }
	  if($_FILES[uploadfile][name] != ''&&$_FILES[uploadfile][size]>50000){
		  $err .= "Only accept image size less than 50KB.";
	  }
	  if($err == '' ){
		  /*
		 if(trim($_POST['sam']) == "Buy Now"){
			// echo "1";
			 $_SESSION['reginfo'] = $_POST;
		     echo "<meta http-equiv=\"refresh\" content=\"0;URL=register.php?act=rec2\">";
		     exit;
		 }
		 */
		 if($_POST[action]=="rec_doinsert"){
			  include("./insert_do/rec_reg.php");
		 }
		 if($_POST[action]=="rec_update"){
			  include("./insert_do/rec_upd.php");
		 }
	  }

	  $_GET[act] = "rec";
	  if($_POST[action]=="rec_update"){
	  $_GET[act] = "recruiter";
	  }
}

if($_POST[action]=="can_doinsert"||$_POST[action]=="can_update"){
	 // print_r($_POST);
	  $err = '';
      if($_POST['user_name']==''){
	      $err .= "Username is required<br />";
	  }elseif(strlen($_POST['user_name'])<6||strlen($_POST['user_name'])>12){
		$err .= "Username length minimum: 6 , maximum: 12<br />";
	  }
	  if($_POST[password]==''&&$_POST[action]=='can_doinsert'){
	      $err .= "Password is required<br />";
	  }
	  if($_POST[password]!=''&&strlen($_POST[password])< 6){
	      $err .= "Password length minimum: 6 <br />";
	  }
	  if($_POST[password2]==''&&$_POST[action]=='can_doinsert'){
	      $err .= "Confirm password is required<br />";
	  }
	  if($_POST[password2]!=''&&$_POST[password2]!=$_POST[password]){
	      if($_POST[action]=='can_doinsert'){
		   $err .= "Your password entries did not match!<br />";
		  }
	  }
	  if($_POST[firstname]==''){
	      $err .= "First name is required<br />";
	  }
	  if($_POST[lastname]==''){
	      $err .= "Last Name is required<br />";
	  }
	  if($_POST[email]==''){
	      $err .= "Email address is required<br />";
	  }elseif(!ereg("^[a-zA-Z0-9][a-zA-Z0-9_\.]+[a-zA-Z0-9]@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$", $_POST[email])){
	      $err .= "Invalid Email address<br />";
	  }
	  if($_POST[phone]==''){
	      $err .= "Phone is required<br />";
	  }
	  if($_POST[jobtitle]==''){
	      $err .= "Job title is required<br />";
	  }
	  if($_POST[industry]=='0'){
	      $err .= "Industry Category must select one from the list<br />";
	  }
	  if($_POST[address]==''){
	      $err .= "Address is required<br />";
	  }
	  if($_POST[locity]==''){
	      $err .= "City is required<br />";
	  }
	  if($_POST[lostate]=='0'){
	      $err .= "State must select one from the list<br />";
	  }
	  if($_POST[locountry]=='0'){
	      $err .= "Country must select one from the list<br />";
	  }
	  if($_POST[lozip]==''||$_POST[lozip]=='0'){
	      $err .= "Zip Code is required<br />";
	  }
	  if($_POST[howus]==''){
	      $err .= "How did you hear about us is required<br />";
	  }
	  if($_POST[agree1]!='1'&&$_POST[action]=='can_doinsert'){
	      $err .= "You must agree to and accept enetRecruiter's Terms of Use agreement<br />";
	  }
	  if($_POST[agree2]!='1'&&$_POST[action]=='can_doinsert'){
	      $err .= "You must agree to and provide professional reference information<br />";
	  }
	  if(!PhpCaptcha::Validate($_POST['imagecode'])&&$_POST[action]=="can_doinsert"){
		  $err .= "Invalid Safe Code.  Please try again.";
	  }

	  if($err == '' ){
			 if($_POST[action]=="can_doinsert"){
			      include("./insert_do/can_reg.php");
			 }
			 if($_POST[action]=="can_update"){
			      include("./insert_do/can_upd.php");
			 }
	  }

	  $_GET[act] = "can";
	  if($_POST[action]=="can_update"){
	  $_GET[act] = "candidate";
	  }
}

if($_POST[action]=="emp_doinsert"||$_POST[action]=="emp_update"){
	//print_r($_POST);
	  $err = '';
      if($_POST['user_name']==''){
	      $err .= "Username is required<br />";
	  }elseif(strlen($_POST['user_name'])<6||strlen($_POST['user_name'])>12){
		$err .= "Username length minimum: 6 , maximum: 12<br />";
	  }
	  if($_POST[password]==''&&$_POST[action]=='emp_doinsert'){
	      $err .= "Password is required<br />";
	  }
	  if($_POST[password]!=''&&strlen($_POST[password])< 6){
	      $err .= "Password length minimum: 6<br />";
	  }
	  if($_POST[password2]==''&&$_POST[action]=='emp_doinsert'){
	      $err .= "Confirm password is required<br />";
	  }
	  if($_POST[password2]!=''&&$_POST[password2]!=$_POST[password]){
	      if($_POST[action]=='emp_doinsert'){
		   $err .= "Your password entries did not match!<br />";
		  }
	  }
	  if($_POST[firstname]==''){
	      $err .= "First name is required<br />";
	  }
	  if($_POST[lastname]==''){
	      $err .= "Last Name is required<br />";
	  }
	  if($_POST[email]==''){
	      $err .= "Email address is required<br />";
	  }elseif(!ereg("^[a-zA-Z0-9][a-zA-Z0-9_\.]+[a-zA-Z0-9]@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$", $_POST[email])){
	      $err .= "Invalid Email address<br />";
	  }
	  if($_POST[phone]==''){
	      $err .= "Phone is required<br />";
	  }
	  if($_POST[jobtitle]==''){
	      $err .= "Job title is required<br />";
	  }
	  if($_POST[howus]==''){
	      $err .= "How did you hear about us is required<br />";
	  }

	  if($_POST[companyname]==''){
	      $err .= "Company name is required<br />";
	  }
	  if($_POST[companyurl]==''){
	      $err .= "Company Website URL is required<br />";
	  }
	  if($_POST[industry]=='0'){
	      $err .= "Industry Category must select one from the list<br />";
	  }
      if($_POST[companysize]==''){
	      $err .= "Company size is required<br />";
	  }
	  if($_POST[address]==''){
	      $err .= "Business Address is required<br />";
	  }
	  if($_POST[locity]==''){
	      $err .= "City is required<br />";
	  }
	  if($_POST[lostate]=='0'){
	      $err .= "State must select one from the list<br />";
	  }
	  if($_POST[lozip]==''){
	      $err .= "Zip is required<br />";
	  }
	  if($_POST[locountry]=='0'){
	      $err .= "Country must select one from the list<br />";
	  }
	  if($_POST[agree1]!='1'&&$_POST[action]=='emp_doinsert'){
	      $err .= "You must agree to and accept enetRecruiter's Terms of Use agreement<br />";
	  }
	  if($_POST[agree2]!='1'&&$_POST[action]=='emp_doinsert'){
	      $err .= "You must agree to and provide professional reference information<br />";
	  }
	   if(!PhpCaptcha::Validate($_POST['imagecode'])&&$_POST[action]=="emp_doinsert"){
		  $err .= "Invalid Safe Code.  Please try again.";
	  }

	  if($err == '' ){
			 if($_POST[action]=="emp_doinsert"){
			      include("./insert_do/emp_reg.php");
			 }
			 if($_POST[action]=="emp_update"){
			      include("./insert_do/emp_upd.php");
			 }
	  }

	  $_GET[act] = "emp";
	  if($_POST[action]=="emp_update"){
	  $_GET[act] = "employer";
	  }
}


if($_POST[action]=="adv_doinsert"||$_POST[action]=="adv_update"){
	  $err = '';
	  //print_r($_POST);
      if($_POST['user_name']==''){
	      $err .= "Username is required<br />";
	  }elseif(strlen($_POST['user_name'])<6||strlen($_POST['user_name'])>12){
		$err .= "Username length minimum: 6 , maximum: 12<br />";
	  }
	  if($_POST[password]==''&&$_POST[action]=='adv_doinsert'){
	      $err .= "Password is required<br />";
	  }
	  if($_POST[password]!=''&&strlen($_POST[password])< 6){
	      $err .= "Password length minimum: 6<br />";
	  }
	  if($_POST[password2]==''&&$_POST[action]=='adv_doinsert'){
	      $err .= "Confirm password is required<br />";
	  }
	  if($_POST[password2]!=''&&$_POST[password2]!=$_POST[password]){
	      if($_POST[action]=='adv_doinsert'){
		   $err .= "Your password entries did not match!<br />";
		  }
	  }
	  if($_POST[firstname]==''){
	      $err .= "First name is required<br />";
	  }
	  if($_POST[lastname]==''){
	      $err .= "Last Name is required<br />";
	  }
	  if($_POST[email]==''){
	      $err .= "Email address is required<br />";
	  }elseif(!ereg("^[a-zA-Z0-9][a-zA-Z0-9_\.]+[a-zA-Z0-9]@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$", $_POST[email])){
	      $err .= "Invalid Email address<br />";
	  }
	  if($_POST[phone]==''){
	      $err .= "Phone is required<br />";
	  }
	  if($_POST[jobtitle]==''){
	      $err .= "Job title is required<br />";
	  }
      if($_POST[spokenlanguage]==''){
	      $err .= "Spoken languages is required<br />";
	  }
      if($_POST[yrexp]==''){
	      $err .= "Year of experience is required<br />";
	  }
      if($_POST[description]==''){
	      $err .= "Your brief description is required<br />";
	  }
	  if($_POST[howus]==''){
	      $err .= "How did you hear about us is required<br />";
	  }

	  if($_POST[companyname]==''){
	      $err .= "Company name is required<br />";
	  }
	  if($_POST[industry]=='0'){
	      $err .= "Industry Category must select one from the list<br />";
	  }
      if($_POST[companysize]==''){
	      $err .= "Company size is required<br />";
	  }
	  if($_POST[address]==''){
	      $err .= "Address is required<br />";
	  }
	  if($_POST[locity]==''){
	      $err .= "City is required<br />";
	  }
	  if($_POST[lostate]=='0'){
	      $err .= "State must select one from the list<br />";
	  }
	  if($_POST[lozip]==''){
	      $err .= "Zip is required<br />";
	  }
	  if($_POST[locountry]=='0'){
	      $err .= "Country must select one from the list<br />";
	  }
	  if($_POST[generalarea]=='0'){
	      $err .= "Your general service area must select one from the list<br />";
	  }
      if($_POST[pristate]=='0'){
	      $err .= "Primary service area state must select one from the list<br />";
	  }
	   if($_POST[pricountry]=='0'){
	      $err .= "Primary service area country must select one from the list<br />";
	  }
	  if($_POST[specialty]==''){
	      $err .= "Your specialty must select one from the list<br />";	  
	  }

	  if($_POST[agree1]!='1'&&$_POST[action]=='adv_doinsert'){
	      $err .= "You must agree to and accept enetRecruiter's Terms of Use agreement<br />";
	  }
	  if($_POST[agree2]!='1'&&$_POST[action]=='adv_doinsert'){
	      $err .= "You must agree to and provide professional reference information<br />";
	  }
      if(!PhpCaptcha::Validate($_POST['imagecode'])&&$_POST[action]=="adv_doinsert"){
		  $err .= "Invalid Safe Code.  Please try again.<br>";
	  }
	  if($_FILES[uploadfile][name] != ''&&$_FILES[uploadfile][size]>50000){
		  $err .= "Only accept image size less than 50KB.";
	  }
	  if($err == '' ){
			 if($_POST[action]=="adv_doinsert"){
			      include("./insert_do/adv_reg.php");
			 }
			 if($_POST[action]=="adv_update"){
			      include("./insert_do/adv_upd.php");
			 }
	  }

	  $_GET[act] = "adv";
	  if($_POST[action]=="adv_update"){
	  $_GET[act] = "advisor";
	  }

}


if($_POST[action]=="rec_doinsert2"||$_POST[action]=="rec_update2"){
	  $err = '';
	  //print_r($_POST);
      if($_POST['licensenumber']==''){
	      $err .= "License number is required<br />";
	  }elseif(strlen($_POST['user_name'])<6||strlen($_POST['user_name'])>12){
		$err .= "Username length minimum: 6 , maximum: 12<br />";
	  }
	  if($_POST[licenseissue]==''){
	      $err .= "License issuing city,state,country is required<br />";
	  }
	  if($_POST[licensephone]==''){
	      $err .= "Licensing office phone number is required<br />";
	  }
	  if($_POST[companyname1]==''){
	      $err .= "Company name (1) is required<br />";
	  }
	  if($_POST[contactname1]==''){
	      $err .= "Contact Name (1) is required<br />";
	  }
	  if($_POST[phonenumber1]==''){
	      $err .= "Phone Number (1) is required<br />";
	  }
	  if($_POST[email1]==''){
	      $err .= "Email (1) is required<br />";
	  }
	  if($_POST[relationship1]==''){
	      $err .= "Relationship(1) is required<br />";
	  }
	   if($_POST[companyname2]==''){
	      $err .= "Company name (2) is required<br />";
	  }
	  if($_POST[contactname2]==''){
	      $err .= "Contact Name (2) is required<br />";
	  }
	  if($_POST[phonenumber2]==''){
	      $err .= "Phone Number (2) is required<br />";
	  }
	  if($_POST[email2]==''){
	      $err .= "Email (2) is required<br />";
	  }
	  if($_POST[relationship2]==''){
	      $err .= "Relationship(2) is required<br />";
	  }
	   if($_POST[companyname3]==''){
	      $err .= "Company name (3) is required<br />";
	  }
	  if($_POST[contactname3]==''){
	      $err .= "Contact Name (3) is required<br />";
	  }
	  if($_POST[phonenumber3]==''){
	      $err .= "Phone Number (3) is required<br />";
	  }
	  if($_POST[email3]==''){
	      $err .= "Email (3) is required<br />";
	  }
	  if($_POST[relationship3]==''){
	      $err .= "Relationship(3) is required<br />";
	  }
	
    // echo $err;
	  if($err == '' ){
			 if($_POST[action]=="rec_doinsert2"){
			      include("./insert_do/rec_reg.php");
			 }
			 if($_POST[action]=="rec_update2"){
			      include("./insert_do/rec_upd2.php");
			 }
	  }

	  $_GET[act] = "rec2";
	  if($_POST[action]=="rec_update2"){
	  $_GET[rec] = "2";
	  }

}

?>